window.addEventListener("load",()=>{
	let select = document.querySelector("#select");//获取选择文件对象
	let img = document.querySelector("#myImg");//获取图像对象

	//给选择文件添加change事件
	select.addEventListener("change",async function(){
		let reader = new FileReader();
		let item = this.files[0]
		reader.readAsText(item);
		
		reader.addEventListener("load",async function(){
			console.log(this.result);
			await eel.wordcloud_base64(item.name, this.result)((base64)=>{
				console.log(base64)
				img.setAttribute("src",base64);
				img.style.display = "block";
			});

		})

	});
});
